package com.liu.blindBox.mapper;

import com.liu.blindBox.entity.base.SaleInfoBase;
import com.liu.blindBox.entity.dto.BlindBoxAmountInfoDTO;
import com.liu.blindBox.entity.dto.UserDeductionInfoDTO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

@Mapper
public interface BuyBlindBoxMapper {

    /**
     * 获取并计算盲盒价格信息
     * @param blindBoxIdList 盲盒id
     * @return List<BlindBoxAmountInfoDTO>
     */
    List<BlindBoxAmountInfoDTO> queryBlindBoxAmountInfo(@Param("blindBoxIdList") List<String> blindBoxIdList);

    /**
     * 插入盲盒销售信息
     * @param saleInfoBaseList 销售信息
     */
    void insertBlindBoxAmountInfo(@Param("saleInfoBaseList") List<SaleInfoBase> saleInfoBaseList);

    /**
     * 获取用户余额
     * @param userId 用户id
     * @return BigDecimal
     */
    BigDecimal queryUserBalance(@Param("userId") String userId);

    /**
     * 更新用户余额
     * @param userId 用户id
     * @param deduction 余额
     */
    void updateUserBalance(@Param("userId") String userId, @Param("deduction") BigDecimal deduction);

    /**
     * 更新用户销售情况表
     */
    void insertUserDeduction(@Param("infoQOList") List<UserDeductionInfoDTO> userDeductionInfoDTOList);
}
